/*
 * SpeedLabelAndSliderSynchronizator.cpp
 *
 *  Created on: 05-01-2011
 *      Author: Przemek
 */

#include "listener/SpeedLabelAndSliderSynchronizator.hpp"
#include "pch.hpp"
using namespace std;
using namespace boost;

SpeedLabelAndSliderSynchronizator::SpeedLabelAndSliderSynchronizator(Label* label,
		const Slider* slider) :
	label(label), slider(slider)
{

}

void SpeedLabelAndSliderSynchronizator::mouseReleased(const MouseListener::EventArguments&)
{
	synchronize();
}
void SpeedLabelAndSliderSynchronizator::mouseDragged(const MouseListener::EventArguments&)
{
	synchronize();
}

void SpeedLabelAndSliderSynchronizator::synchronize()
{
	const string& newText = "x" + lexical_cast<string> (slider->getValue());
	label->setText(newText);
}
